package com.ruoyi.cmdb.service.impl;

import java.util.List;

import com.ruoyi.cmdb.util.GetId;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.cmdb.mapper.PortMapper;
import com.ruoyi.cmdb.domain.Port;
import com.ruoyi.cmdb.service.IPortService;

/**
 * portService业务层处理
 *
 * @author ruoyi
 * @date 2023-01-27
 */
@Service
public class PortServiceImpl implements IPortService
{
    GetId getId=new GetId();//用这个类的方法生成当前时间的id
    @Autowired
    private PortMapper portMapper;

    /**
     * 查询port
     *
     * @param id port主键
     * @return port
     */
    @Override
    public Port selectPortById(String id)
    {
        return portMapper.selectPortById(id);
    }

    /**
     * 查询port列表
     *
     * @param port port
     * @return port
     */
    @Override
    public List<Port> selectPortList(Port port)
    {
        return portMapper.selectPortList(port);
    }

    /**
     * 新增port
     *
     * @param port port
     * @return 结果
     */
    @Override
    public int insertPort(Port port)
    {
        port.setId(getId.getTimeId());
        port.setCreateTime(DateUtils.getNowDate());
        return portMapper.insertPort(port);
    }

    /**
     * 修改port
     *
     * @param port port
     * @return 结果
     */
    @Override
    public int updatePort(Port port)
    {
        port.setUpdateTime(DateUtils.getNowDate());
        return portMapper.updatePort(port);
    }

    /**
     * 批量删除port
     *
     * @param ids 需要删除的port主键
     * @return 结果
     */
    @Override
    public int deletePortByIds(String[] ids)
    {
        return portMapper.deletePortByIds(ids);
    }

    /**
     * 删除port信息
     *
     * @param id port主键
     * @return 结果
     */
    @Override
    public int deletePortById(String id)
    {
        return portMapper.deletePortById(id);
    }
}
